package org.jeecg.modules.zcgl.vo;

import lombok.Data;
import org.jeecg.modules.zcgl.entity.AssetCategory;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * @author 尹涛 * @version V1.0.0
 * @projectName bingjiang-parent
 * @title AssetFixedCategoryTreeModel
 * @package org.jeecg.modules.zcgl.vo
 * @description
 * @date 2021/6/30
 */
@Data
public class AssetCategoryTreeModel extends AssetCategory implements Serializable {

    private static final long serialVersionUID = 1L;

    /** 对应SysDepart中的id字段,前端数据树中的key*/
    private String key;

    /** 对应SysDepart中的id字段,前端数据树中的value*/
    private String value;

    /** 对应depart_name字段,前端数据树中的title*/
    private String title;


    private boolean isLeaf;


    private List<AssetCategoryTreeModel> children = new ArrayList<>();


    /**
     * 将SysDepart对象转换成SysDepartTreeModel对象
     * @param category
     */
    public AssetCategoryTreeModel(AssetCategory category) {

        this.key = category.getId();
        this.value = category.getId();
        this.title = category.getName();
        this.setId(category.getId());
        this.setParentId(category.getParentId());
        this.setName(category.getName());
        this.setLevel(category.getLevel());
        this.setLocation(category.getLocation());
        this.setSort(category.getSort());
        this.setIzLeaf(category.getIzLeaf());
        this.setCreateBy(category.getCreateBy());
        this.setCreateTime(category.getCreateTime());
        this.setUpdateBy(category.getUpdateBy());
        this.setUpdateTime(category.getUpdateTime());
    }


    public AssetCategoryTreeModel() { }
 }
